﻿@{
    ViewBag.Title = "后台登录";
    Layout = null;
   
}
    <meta http-equiv="X-UA-Compatible" content="IE=10" /> 
<script src="~/Content/assets/js/jquery-1.10.2.min.js"></script>
<script src="~/Content/assets/js/common.js"></script>
<script src="~/Content/assets/plugins/validator/validator.js"></script>
<link href="~/Content/assets/shly_css/plugin/validator.css" rel="stylesheet" />
<link href="~/Content/assets/css/style.login.css" rel="stylesheet" />
<script src="~/Content/assets/js/jquery.md5.js"></script>
<body class="loginpage">
    <div class="loginbox">
        <div class="loginboxinner">

            <div class="logo">
                <h1 class="logo">@System.Configuration.ConfigurationManager.AppSettings["website"].ToString()</h1>
                <span class="slogan">后台管理系统</span>
            </div>
            <!--logo-->

            <form id="frmEdit" name="frmEdit" method="post" action="@Url.Action("Singin")">

                <div class="username">
                    <div class="usernameinner">
                        <input type="text" name="Name" id="Name" placeholder="请输入登录账号" value="" />
                    </div>
                </div>

                <div class="password">
                    <div class="passwordinner">
                        <input type="password"  id="Password" placeholder="请输入登录密码" value="" />
                        <input type="hidden" name="Password" id="mPassword"  value="123456"/>
                    </div>
                </div>
                <div class="validcode">
                    <div class="validcodedinner">
                        <input type="text" name="Code" maxlength="5" id="validcode" placeholder="请输入验证码"   /> 
                       
                    </div>
                    <div style="float:right;margin-top:-40px;">
                         <img id="valiCode" style="cursor: pointer;width:90px;" src="/Login/GetValidateCode" alt="验证码" />
                    </div>
                </div><a ></a>
                <button id="btnSave">登录</button>
            </form>

        </div>
        <!--loginboxinner-->
    </div>
    <!--loginbox-->
</body>
<script type="text/javascript">
    ; (function (window, undefined, $) {
        $(document).ready(function () {

            $("#btnSave").click(function (e) { 
                var name = $("#Name").val();
                if(name==null||name=="")
                {
                    alert("请输入登录账号");
                    $("#Name").focus();
                    return false;
                }
                var password = $("#Password").val();
                if (password == null || password == "") {
                    alert("请输入登录密码");
                    $("#Password").focus();
                    return false;
                }
                //var validcode = $("#validcode").val();
                //if (validcode == null || validcode == "") {
                //    alert("请输入验证码");
                //    $("#validcode").focus();
                //    return false;
                //}
                $("#mPassword").val($.md5($("#Password").val()));
                $("#frmEdit").submit();
            });

            var submiting = false;
            $('#frmEdit').validator({
                valid: function (form) {
                    if (submiting) {
                        return;
                    }
                    submiting = true;
                    FormSubmit(form, function (res) {
                        if (res.Status > 0) {
                            window.location.href = res.Data;

                        }
                        else {
                            //$("#errorTip").html(res.Message);
                            alert(res.Message);
                        }
                        submiting = false;
                    })
                }
            });

            $("#valiCode").bind("click", function () {
                this.src = "/Login/GetValidateCode?time=" + (new Date()).getTime();
            });

        });


    })(window, undefined, jQuery);
</script>
